# import math
# class NegativeRadiusException(Exception):
#     pass
# radius = float(input("请输入圆的半径:"))
# try:
#     if radius < 0:
#         raise NegativeRadiusException("圆的半径不能为负数")
#     else:
#         area = math.pi * radius ** 2
#     print("圆的面积为:",area)
#
# except NegativeRadiusException as e:
#     print("错误信息为:",e)

import math
class NegativeRaduisException(Exception):
    pass
raduis = float(input("请输入圆的半径:"))
try:
    if raduis < 0:
        raise NegativeRaduisException("圆的半径不能为负数")
    else:
        aero = math.pi * raduis ** 2
    print("圆的面积为:",aero)
except NegativeRaduisException as e:
    print("错误信息为:",e)